﻿namespace WMS6.Web.Configuration
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class EquipmentTypeQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlCubicCapacity;
        protected DropDownList ddlDescr;
        protected DropDownList ddlEquipmentTypeID;
        protected DropDownList ddlHeight;
        protected DropDownList ddlIsActive;
        protected DropDownList ddlIsActiveOper;
        protected DropDownList ddlLength;
        protected DropDownList ddlWeightCapacity;
        protected DropDownList ddlWidth;
        protected HtmlForm F2240;
        protected HtmlInputHidden hdnActionID;
        protected Label lblBu;
        protected Label lblCubicCapacity;
        protected Label lblDescr;
        protected Label lblEquipmentTypeID;
        protected Label lblHeight;
        protected Label lblIsActive;
        protected Label lblLength;
        protected Label lblWeightCapacity;
        protected Label lblWidth;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtCubicCapacity;
        protected TextBox txtDescr;
        protected TextBox txtEquipmentTypeID;
        protected TextBox txtHeight;
        protected TextBox txtLength;
        protected TextBox txtWeightCapacity;
        protected TextBox txtWidth;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("EquipmentTypeList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("EquipmentTypeList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDll()
        {
            base.InitQueryDDL(this.ddlCubicCapacity, 0);
            base.InitQueryDDL(this.ddlDescr, 0);
            base.InitQueryDDL(this.ddlEquipmentTypeID, 0);
            base.InitQueryDDL(this.ddlHeight, 0);
            base.InitQueryDDL(this.ddlLength, 0);
            base.InitQueryDDL(this.ddlWeightCapacity, 0);
            base.InitQueryDDL(this.ddlWidth, 0);
            base.InitQueryDDL(this.ddlIsActiveOper, 0);
            base.InitIsActiveDDL(this.ddlIsActive, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
                if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
                {
                    this.btnExport.Visible = false;
                    this.btnNew.Visible = false;
                    this.ddlIsActive.SelectedValue = "Y";
                    this.ddlIsActive.Enabled = false;
                }
            }
        }

        public string CubicCapacity
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCubicCapacity.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCubicCapacity.Text.Trim(), this.ddlCubicCapacity.SelectedValue);
                }
                return "";
            }
        }

        public string Descr
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDescr.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDescr.Text.Trim(), this.ddlDescr.SelectedValue);
                }
                return "";
            }
        }

        public string EquipmentTypeID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEquipmentTypeID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtEquipmentTypeID.Text.Trim(), this.ddlEquipmentTypeID.SelectedValue);
                }
                return "";
            }
        }

        public string Height
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtHeight.Text.Trim()))
                {
                    return base.GetParamsString(this.txtHeight.Text.Trim(), this.ddlHeight.SelectedValue);
                }
                return "";
            }
        }

        public string IsActive
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsActive.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsActive.SelectedValue, this.ddlIsActiveOper.SelectedValue);
                }
                return "";
            }
        }

        public string Length
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLength.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLength.Text.Trim(), this.ddlLength.SelectedValue);
                }
                return "";
            }
        }

        public string WeightCapacity
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtWeightCapacity.Text.Trim()))
                {
                    return base.GetParamsString(this.txtWeightCapacity.Text.Trim(), this.ddlWeightCapacity.SelectedValue);
                }
                return "";
            }
        }

        public string Width
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtWidth.Text.Trim()))
                {
                    return base.GetParamsString(this.txtWidth.Text.Trim(), this.ddlWidth.SelectedValue);
                }
                return "";
            }
        }
    }
}

